const hre = require("hardhat");

async function main() {
  const contractAddress = "0xb16c4FD708b88220e02fC54cBF5291A70Ad4a5Ee";
  
  // 获取合约ABI
  const BSCLaunchPad = await hre.ethers.getContractFactory("BSCLaunchPad");
  const contract = BSCLaunchPad.attach(contractAddress);
  
  console.log("Contract address:", contractAddress);
  
  try {
    // 检查是否暂停
    const paused = await contract.paused();
    console.log("Contract paused:", paused);
    
    // 检查当前launch ID
    const currentLaunchId = await contract.getCurrentLaunchId();
    console.log("Current launch ID:", currentLaunchId.toString());
    
    // 检查launch 0的信息
    if (currentLaunchId > 0) {
      const launch = await contract.tokenLaunches(0);
      console.log("Launch 0 info:", {
        tokenAddress: launch.tokenAddress,
        creator: launch.creator,
        launched: launch.launched,
        cancelled: launch.cancelled,
        deadline: new Date(Number(launch.deadline) * 1000).toISOString(),
        raisedAmount: hre.ethers.formatEther(launch.raisedAmount),
        tokensSold: hre.ethers.formatEther(launch.tokensSold)
      });
    }
    
  } catch (error) {
    console.error("Error checking contract:", error.message);
  }
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });
